package com.ruoyi.product;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.product.domain.TbBrand;
import com.ruoyi.product.service.ITbBrandService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import javax.validation.constraints.AssertTrue;

import java.util.Date;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
 * @Author: 鑫仔
 * @Date: 2025/8/6 20:42
 * @Description:
 **/
@SpringBootTest
public class Brand {

    @Autowired
    private ITbBrandService brandService;

    @Test
    public void testGetBrand() {
        TbBrand tbBrand = brandService.selectTbBrandByBrandId(3);
        System.out.println(tbBrand);
        assertTrue(brandService.selectTbBrandByBrandId(3) != null);
    }


    @Test
    public void testGetBrandList() {
        AjaxResult brandList = brandService.getBrandList();
        System.out.println(brandList);
        assertTrue(brandList.isSuccess());
    }


    @Test
    public void testAddBrand() {
        TbBrand tbBrand = new TbBrand();
        tbBrand.setBrandName("测试哈哈");
        tbBrand.setBrandUse(122);
        tbBrand.setBrandStatus(1);
        tbBrand.setBrandTop(1);
        tbBrand.setCreateTime(new Date());
        tbBrand.setCreateBy("admin");
        int i = brandService.insertTbBrand(tbBrand);
        System.out.println(i);
        assertTrue(i > 0);
    }
}
